package com.atguigu.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
//@RequestMapping("/hello")
public class RequestMappingController {

   @RequestMapping( value = {"/testRequestMapping", "/test"},
                method = {RequestMethod.POST, RequestMethod.GET},
           params = {"username"}
   )

    public  String success(){

       return  "success";
   }

   @RequestMapping(value = "/testParamsAndHeaders",
           params = {"username"})
    public String testParamsAndHeaders(){
       return "success";
   }

   @RequestMapping("/testPath/{id}")
    public String testPath(@PathVariable("id")Integer id){
       System.out.println("id = " + id);
       return "success";
   }

}
